package com.example.scancodelogindemo.service;


import com.example.scancodelogindemo.model.QrCodeInfo;
import com.example.scancodelogindemo.model.vo.QrCodeVO;
import org.redisson.api.RBucket;

import javax.servlet.http.HttpServletRequest;


/**
 * @author 傲寒
 * @date 2023/12/5
 */
public interface QrcodeLoginService {

    /**
     * 创建qr码
     *
     * @return {@link QrCodeVO}
     */
    QrCodeVO createQrCode();

    /**
     * 检查qr状态
     *
     * @param qrcodeId qrcode id
     * @return {@link String}
     */
    QrCodeInfo checkQrState(String qrcodeId);


    /**
     * 扫描
     *
     * @param qrcodeId qrcode id
     * @return {@link Object}
     */
    Boolean scan(String qrcodeId, HttpServletRequest request);

    /**
     * 确认
     *
     * @param request  请求
     * @param qrcodeId qrcode id
     */
    void confirm(String qrcodeId, HttpServletRequest request);

    /**
     * 取消
     *
     * @param qrcodeId qrcode id
     */
    void cancel(String qrcodeId);

    RBucket<QrCodeInfo> getQrCodeInfoBucket(String qrcodeId);

}
